/**
 * 父类
 * 属性：
 */
class JuXing {
    constructor(width, height, left, top, xSpeed, ySpeed, dom) {
        this.width = width;
        this.height = height;
        this.left = left;
        this.top = top;
        this.xSpeed = xSpeed;
        this.ySpeed = ySpeed;
        this.dom = dom;
        this.rander();
    }
    /**
     * 渲染
     */
    rander() {
        this.dom.style.width = this.width + 'px';
        this.dom.style.height = this.height + 'px';
        this.dom.style.left = this.left + 'px';
        this.dom.style.top = this.top + 'px';
    }

    /**
     * 运动
     * @param {*} shijian 时间
     */
    move(shijian) {
        let newLeft = this.xSpeed * shijian;
        let newTop = this.ySpeed * shijian;
        this.left = this.left + newLeft;
        this.top = this.top + newTop;
        if(this.onMove){
            this.onMove();
        }
        this.rander();
    }
}